package exam.demo22;

import java.util.Scanner;

// AC
public class Test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int max = 0;
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
            max = Math.max(arr[i], max);
        }
        boolean flg = false;
        for(int i = 0; i < n; i++) {
            if(max % arr[i] != 0) {
                System.out.println("NO");
                flg = true;
                break;
            }
        }
        if(!flg) {
            System.out.println("YES");
        }
    }
}
